package com.cat.dynamicPlanning;

import java.util.Arrays;
/**
 * @author 曲大人的喵
 * @description https://leetcode.cn/problems/count-ways-to-build-good-strings/description/
 * @create 2025/8/27 08:54
 * @since JDK17
 */

public class Solution06 {
    static long[] dp = new long[100002];
    static int N = (int)(1e9 + 7);
    public int countGoodStrings(int low, int high, int zero, int one) {
        Arrays.fill(dp, 0, high + 1, 0);
        for (int i = low; i <= high; i++) {
            dp[i] = 1;
        }
        for (int i = high - 1; i >= 0; i--) {
            if (zero + i <= high) {
                dp[i] += dp[i + zero];
            }
            if (one + i <= high) {
                dp[i] += dp[i + one];
            }
            dp[i] %= N;
        }
        return (int)dp[0];
    }
}